﻿using Ingenta.IRepository;
using Ingenta.IServices;
using Ingenta.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Ingenta.Services
{
    public class BaseServices<TEntity> : IBaseServices<TEntity> where TEntity : class
    {
        public IBaseRepository<TEntity> baseDal;

        /// <summary>
        /// 单表查询
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        public List<TEntity> QueryWhere(Expression<Func<TEntity, bool>> predicate)
        {
            return baseDal.QueryWhere(predicate);
        }

        public void Add(TEntity model)
        {
            baseDal.Add(model);
        }

        public int SaveChanges()
        {
            return baseDal.SaveChanges();
        }
    }
}
